<h1>Listing comments</h1>

<table>
  <tr>
    <th>Content</th>
    <th>User</th>
    <th>Code</th>
  </tr>

<% @comments.each do |comment| %>
  <tr>
    <td><%=h comment.content %></td>
    <td><%=h comment.user.username %></td>
    <td><%=h comment.code.title %></td>
    <td><%= link_to 'Show', comment %></td>
    <td><%= link_to 'Edit', edit_comment_path(comment) %></td>
    <td><%= link_to 'Destroy', comment, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New comment', new_comment_path %>
